package br.com.news.service;

import java.util.List;

import javax.inject.Inject;
import javax.inject.Named;

import br.com.news.utils.business.exception.BusinessException;
import br.com.news.utils.business.interfaces.IRespostaEnqueteBusiness;
import br.com.news.utils.database.beans.RespostaEnqueteBean;
import br.com.news.utils.service.exception.ServiceException;
import br.com.news.utils.service.interfaces.IRespostaEnqueteService;

@Named
public class RespostaEnqueteService implements IRespostaEnqueteService{

	@Inject
	private IRespostaEnqueteBusiness respostaEnqueteBusiness;
	
	@Override
	public List<RespostaEnqueteBean> findAll() throws ServiceException {
		try {
			return respostaEnqueteBusiness.findAll();
		} catch (BusinessException e) {
			throw new ServiceException(e);
		}
	}

	@Override
	public void save(RespostaEnqueteBean respostaEnquete) throws ServiceException {
		try {
			respostaEnqueteBusiness.save(respostaEnquete);
		} catch (BusinessException e) {
			throw new ServiceException(e);
		}
	}

	@Override
	public List<RespostaEnqueteBean> resultVoteXml(long idEnquete) throws ServiceException {
		try {
			return respostaEnqueteBusiness.resultVoteXml(idEnquete);
		} catch (BusinessException e) {
			throw new ServiceException(e);
		}
	}
}
